package cn.gcyl.module.biz.dal.mysql.membershipsettings;

import cn.gcyl.framework.common.pojo.PageResult;
import cn.gcyl.framework.mybatis.core.mapper.BaseMapperX;
import cn.gcyl.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.gcyl.module.biz.controller.admin.membershipsettings.vo.*;
import cn.gcyl.module.biz.dal.dataobject.membershipsettings.MembershipSettingsDO;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;

/**
 * 会员设置 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface MembershipSettingsMapper extends BaseMapperX<MembershipSettingsDO> {

    default PageResult<MembershipSettingsDO> selectPage(MembershipSettingsPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<MembershipSettingsDO>()
//                .likeIfPresent(MembershipSettingsDO::getMembershipName, reqVO.getMembershipName())
//                .eqIfPresent(MembershipSettingsDO::getPrice, reqVO.getPrice())
//                .eqIfPresent(MembershipSettingsDO::getUnderlinedPrice, reqVO.getUnderlinedPrice())
//                .eqIfPresent(MembershipSettingsDO::getConsultationFrequency, reqVO.getConsultationFrequency())
//                .eqIfPresent(MembershipSettingsDO::getRegistrationsFrequency, reqVO.getRegistrationsFrequency())
//                .eqIfPresent(MembershipSettingsDO::getLifeSpan, reqVO.getLifeSpan())
//                .betweenIfPresent(MembershipSettingsDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(MembershipSettingsDO::getId));
    }
    default List<MembershipSettingsDO> getMembershipSettingsList(MembershipSettingsPageReqVO reqVO) {
        return selectList( new LambdaQueryWrapperX<MembershipSettingsDO>()
                .orderByAsc(MembershipSettingsDO::getPrice));
    }

}